<?php
namespace plugin\luyouzujiditu\model;

use think\Model;
use think\facade\Db;

class PluginLuyouzujidituTop extends Model
{
    public function finds($map, $field)
    {
        if ($field) {
            $finds = PluginLuyouzujidituTop::where($map)->field($field)->findOrEmpty();
        } else {
            $finds = PluginLuyouzujidituTop::where($map)->findOrEmpty();
        }
        return $finds;
    }
    public function paginate($map, $field, $order, $page)
    {
        $list = PluginLuyouzujidituTop::where($map)->order($order)->field($field)->paginate($page);
 
 
        $data['list']=$list;
      
        return $data;
    }
    public function adds($request, $field)
    {
        $request['create_time'] = time();
         
        unset($request['id']);
        $adds = new PluginLuyouzujidituTop;
        $adds->save($request);
        return $adds->id;
    }
    public function updates($map, $request, $field)
    {
        $save = PluginLuyouzujidituTop::where($map)->find();
        if ($save) {
            if ($field) {
                return $save->allowField($field)->save($request);
            } else {
                return $save->save($request);
            }
        }
        return false;
    }
    public function dels($map)
    {
        $dels = PluginLuyouzujidituTop::where($map)->find();
        if ($dels) {
            return PluginLuyouzujidituTop::where($map)->delete();
        }
        return false;
    }
    //模型方法
}
